package demo2;

import java.util.ArrayList;

public class ArrayListStudent {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();

        Student s1  = new Student("zhangsan",12);
        Student s2  = new Student("lisi",13);
        Student s3  = new Student("wamhwu",14);

        list.add(s1);
        list.add(s2);
        list.add(s3);

        for (int i = 0; i < list.size(); i++) {
            Student student = list.get(i);
            System.out.println(student.getName() + "," + student.getAge());
        }
    }
}
